package com.zhijiaoyun.service;

import com.zhijiaoyun.model.News;
import com.zhijiaoyun.model.dto.NewsDto;
import com.zhijiaoyun.model.dto.PageList;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author shisfish
 * @date 2017/6/6
 */
public interface INewsService {

    News getNewsByTitle(String title);

    void addNews(News news);

    News getNewsByNewsId(Long newsId);

    News getNewsByTitleNotNewsId(Long newsId, String title);

    void modifyNews(News news);

    PageList<NewsDto> pageByParamsDto(Integer pageIndex, Integer pageSize, String title, List<Long> ids);

    NewsDto getNewsDtoByNewsId(Long newsId);

    PageList<NewsDto> pageByParamsDtoHot(Integer pageIndex, Integer pageSize, String string, ArrayList<Long> arrayList);

    void addViewNum(Long newsId);

    void addPraiseNum(Long newsId);

    void addCommentNum(Long newsId);

    void deleteNews(News news);

    /**
     * 通过newsId删除news
     *
     * @param newsId
     * @return
     */
    Map<String, Object> deleteNewsById(long newsId);

    int countAll();

    /**
     * 分页查找news
     *
     * @param pageIndex
     * @param pageSize
     * @param title
     * @return
     */
    Map<String, Object> pageNews(int pageIndex, int pageSize, String title);

    /**
     * get by id
     *
     * @param newsId
     * @return
     */
    Map<String, Object> getNewsById(Long id);

    /**
     * 新增资讯
     *
     * @param title
     * @param summary
     * @param keyWord
     * @param pictureStr
     * @param source
     * @param author
     * @param content
     * @param request
     * @return
     */
    Map<String, Object> insert(String title, String summary, String keyWord, String pictureStr, String source, String author, String content, HttpServletRequest request);

    /**
     * 修改资讯
     *
     * @param news
     * @param title
     * @param keyWord
     * @param pictureStr
     * @param source
     * @param author
     * @param summary
     * @param content
     * @param request
     * @return
     */
    Map<String, Object> modify(News news, String title, String keyWord, String pictureStr, String source, String author, String summary, String content, HttpServletRequest request);

    /**
     * 分页获取热点新闻
     * @param pageIndex
     * @param pageSize
     * @return
     */
    Map<String,Object> pageNewsHot(int pageIndex, int pageSize);
}
